from sqlalchemy.orm import Session

from app.models.goods_sku import GoodsSku
from app.schemas.goods_sku import GoodsSkuModel


def get_goods_sku(db: Session, goods_id: int) -> list[GoodsSkuModel]:
    """查询商品sku信息"""
    db_goods_skus = db.query(GoodsSku).filter(
        GoodsSku.goods_id == goods_id).all()
    return [GoodsSkuModel.model_validate(r) for r in db_goods_skus]